package com.mpaster.meego.service;

import com.mpaster.meego.dao.PrivilegeRepository;
import com.mpaster.meego.entity.Privilege;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Service
public class PrivilegeServiceImpl implements PrivilegeService {

    @Autowired
    private PrivilegeRepository privilegeRepository;

    @Override
    public List<Privilege> findAll() {
        List<Privilege> privileges = new ArrayList<>();
        Iterator<Privilege> iterator = privilegeRepository.findAll().iterator();
        while (iterator.hasNext()){
            privileges.add(iterator.next());
        }
        return privileges;
    }
}
